<?php if ($sf_user->hasFlash('save')){
?>		
			<div id="notification" class="nNote nSuccess hideit" onclick="$('#notification').hide('slow')" style="margin-top: 40px;">
                <p><strong>SUCCESS: </strong> <?php echo $sf_user->getFlash('save') ?></p>
         </div>

<?php 
}?>

    <div class="head"><h5 class="iList">Select Category for directory <?php echo $directory->getName()?></h5></div>
    <div style="clear: both;">

    	<div style="width: 335px;float: left;">
    		<form action="category_content/getCSV" class="mainForm" id="getCSV" method="post">
     			 <div style="clear: both;width: 500px;">
		        <div class="rowElem noborder" style="float: left;width: 316px;">
		     		<label for="name" style="width: 50px">Category:</label>
		     		<div  style="margin-top: 9px;" >
                    			<select name="level_category_id" id="level_category_id" style="width:240px;" onchange="updateHiddenCategoryIdValue(this.value)"  >
                    				<?php 
                    					
                    					foreach ($categories as $aCategory) {
                    						 $selected = $aCategory->getId() == $selectedCategoryId ? "selected" : "";
                    						
                    					?>
                    						<option <?php echo $selected?>  value="<?php echo $aCategory->getId(); ?>"><?php echo $aCategory->getName(); ?></option>
                    					<?php 
                    					}
                    				?>
                            	</select>     		
		     		
		     		</div>
		     	</div> 	
		     	
		    	<div style="float: left; margin-top: 17px;">
		    		<input type="submit" value="Get Headers" class="greyishBtn submitForm" id="getHeaders" />
		    	</div>		
		    	     	
		     	</div>
		     	
		     </form>
    	</div>
    	
    </div>
     
     		<div class="fix"></div>
     		
     
     
<script type="text/javascript">

		function loadCategories (){

			var php_url = '<?php echo url_for('category_content/loadCategories?directory_id=')?>';
			var directory_id = document.getElementById('directory').value;
			php_url = php_url.concat(directory_id);	
			
			$.ajax({type: 'POST', url:php_url, script:true, cache:false, 
				success: function(data) { 
					 $('#categories_div').html(data);
						updateHiddenCategoryIdValue($('#level_category_id').attr("value"));
					} });
			$('#category_level_tree_div').hide();

		}
		
		$('form').jqTransform({imgPath:'../images/forms'});

		var initial_z_index = 1000;
		  
		$('.jqTransformSelectWrapper').each( function(){
	
				$(this).css('z-index', initial_z_index--);
			});

		function updateHiddenCategoryIdValue(selected_category_id){
			$('#h_category_id').attr('value', selected_category_id);
			$('#category_level_tree_div').hide();
		}
</script>     
